home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / misc / BatTwister.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  981 b   |  45 lines

  1. class classes.misc.BatTwister
  2. {
  3.    var id;
  4.    var batNum;
  5.    var c = 0;
  6.    var twisting = false;
  7.    var i = 0;
  8.    var Name = "batTwister";
  9.    function BatTwister(pbatNum, pid)
  10.    {
  11.       this.id = pid;
  12.       this.batNum = pbatNum;
  13.    }
  14.    function main()
  15.    {
  16.       if(!this.twisting && random(100) > 95)
  17.       {
  18.          this.twisting = true;
  19.       }
  20.       if(this.twisting)
  21.       {
  22.          this.c = this.c + 1;
  23.          if(this.c == 8)
  24.          {
  25.             this.c = 0;
  26.             _root[_root["form" + this.id][this.i]].twist();
  27.             this.i = this.i + 1;
  28.             if(this.i == this.batNum)
  29.             {
  30.                this.twisting = false;
  31.                if(random(2) == 1)
  32.                {
  33.                   _root.removeFX("batTwister" + this.id);
  34.                }
  35.                else
  36.                {
  37.                   this.i = 0;
  38.                   this.c = 0;
  39.                }
  40.             }
  41.          }
  42.       }
  43.    }
  44. }
  45.